﻿using System.Windows.Media.Media3D;

/// <summary>
/// Point3D类的扩展方法类
/// </summary>
public static class Point3DExtensions
{
    /// <summary>
    /// 将三维点转成三维向量
    /// </summary>
    /// <param name="p">三维点</param>
    /// <returns>三维向量</returns>
    public static Vector3D ToVector3D(this Point3D p)
    {
        return new Vector3D(p.X, p.Y, p.Z);
    }

    /// <summary>
    /// 将点p(x,y,z)按指定空间向量平移
    /// </summary>
    /// <param name="p">三维点</param>
    /// <param name="v">指定的空间向量</param>
    /// <returns>平移后的三维点</returns>
    public static Point3D Offset(this Point3D p, Vector3D v)
    {
        return new Point3D(p.X + v.X, p.Y + v.Y,p.Z+v.Z);
    }
}

